package com.itgaoshu.mapper;

import com.itgaoshu.bean.Doctor;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 医生列表
 */
public interface DoctorMapper {
    //查询所有医生相对应的信息
    @Select("select * from doctor d,departments de,registeredtype r where d.departmentid=de.departmentid and d.registeredId=r.registeredid")
    public List<Doctor> selectAllDoctor();
    //添加医生相对应的信息
    @Insert("insert into doctor(doctorname,departmentid,registeredid,dstate)values(#{doctorname},#{departmentid},#{registeredid},#{dstate})")
    public int addDoctor(Doctor doctor);
    //模糊查询医生相对应的信息
    //select a.* from Tadvertisment a where a.title like concat(concat('%',?),'%')
    @Select("select * from doctor d,departments de,registeredtype r where d.departmentid=de.departmentid and d.registeredid=r.registeredid" +
            " where d.doctorname like concat('%',concat(#{doctorname},'%'))")
    public List<Doctor> selectDoctor(Doctor doctor);
    //根据类别id回显医生的方法
    @Select("select * from doctor where departmentid=#{departmentid} ")
    public List<Doctor> selectDoctorbydepartmentid(int departmentid);

}